package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.dto.phaseGroup.PhaseGroupDto;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BasePageResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.phaseGroup.PhaseGroupListReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.phaseGroup.PhaseGroupSelectReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.phaseGroup.PhaseGroupSelectResVo;
import com.zmj.sy.mom.srv.aps.service.PhaseGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "工序工作组关联")
@RestController
@RequestMapping("/phaseGroup")
public class PhaseGroupController {


    private final PhaseGroupService phaseGroupService;

    @ApiOperation("新增工序工作组")
    @PostMapping("/add")
    public BaseResVo add(@RequestBody PhaseGroupDto reqVo){
        phaseGroupService.add(reqVo);
        return BaseResVo.ok();
    }


    @ApiOperation("修改工序工作组")
    @PostMapping("/edit")
    public BaseResVo edit(@RequestBody PhaseGroupDto reqVo){
        phaseGroupService.edit(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("删除工序工作组")
    @PostMapping("/delete")
    public BaseResVo delete(BaseIdReqVo reqVo){
        phaseGroupService.delete(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("工序工作组列表")
    @GetMapping("/list")
    public BasePageResVo<PhaseGroupDto> list(PhaseGroupListReqVo reqVo){
        return phaseGroupService.list(reqVo);
    }

    @ApiOperation("根据工序查询工作组")
    @GetMapping("/select")
    public BaseListResVo<PhaseGroupSelectResVo> select(PhaseGroupSelectReqVo reqVo){
        return phaseGroupService.select(reqVo);
    }

}
